package com.autumn.swagger.configuration;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;

import com.autumn.spring.boot.bean.AbstractImportBeanDefinitionRegister;
import com.autumn.swagger.annotation.EnableAutumnSwagger;

/**
 * Swagger 配置 扫描
 * 
 * @author 老码农
 *
 *         2017-12-01 10:25:01
 */
public class AutumnSwaggerDefinitionRegister extends AbstractImportBeanDefinitionRegister
		implements ImportBeanDefinitionRegistrar {

	@Override
	public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
		AnnotationAttributes annoAttrs = AnnotationAttributes
				.fromMap(importingClassMetadata.getAnnotationAttributes(EnableAutumnSwagger.class.getName()));
		SwaggerInitializer.initialization(annoAttrs);
	}
}
